package com.gopay.webtest.handler;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.gopay.webtest.util.BaseSign;
import com.gopay.webtest.util.ReflectUtil;

@Repository("expayApiSignHandler")
public class ExPayApiSignHandler extends BaseSign{

	@Override
	public String execute(Object obj, List<String> signFields) throws Exception {
		StringBuffer sb = new StringBuffer(512);
		for (String field : signFields) {
			String value =ReflectUtil.getFieldValue(obj, field);
			if(value==null){
				value="";
			}
			if("verficationCode".equals(field))
			{
				sb.append("VerficationCode");
			}else{
				sb.append(field);
			}
			sb.append("=[")
			  .append(value+"]");
		}
		return sb.toString();
	}
}
